<template>
	<view class="favorite">
		<view class="favorite-content">
			<view class="shopping-content">
				<view class="cart-list" v-for="(item,index) in shopping" :key='index'>
					<view class="image-wrapper">
						<image :src="item.img"></image>
					</view>
					<view class="item-right">
						<view class="item-rightName">{{item.title}}</view>
						<view class="item-rightNames">{{item.description}}</view>
						<view class="item-rightNames">累计销售2件</view>
						<view style="color: #909399;">{{item.skuTitle}}</view>
						<view><text style="text-decoration: line-through;">¥{{item.originalPrice/100}}</text><text>¥{{item.price/100}}</text></view>
					</view>
					<view class="del-bt">
						<image @click="deletes(item.spuId)" src="../../static/images/close-icon.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
			Token:"",
			shopping:[]
			}
		},
		onLoad() {
			this.Token = uni.getStorageSync('Token')
			uni.request({
				url:this.$C.webUrl+'m.api?_gp=collect&_mt=getCollectAll',
				header:{
					accessToken:this.Token 
				},
				success: (res) => {
					console.log(res)
					this.shopping=res.data.data.items
				}
			})
		},
		methods:{
			//删除
			deletes(e) {
				console.log(e)
				uni.request({
					url: this.$C.webUrl + 'm.api?_gp=collect&_mt=deleteCollect&spuId=' + e,
					header: {
						'accessToken': this.Token
					},
					success: (res) => {
						console.log(res)
					}
				})
			}
		}
	}
</script>

<style>
	.favorite{
		width: 100%;
	}
/* 	.favorite-content{
		width: 100%;
		height: 93.4vh;
		background: #F8F8F8;
	} */
	.item-rightNames{
		font-size: 28upx;
		color: #909399;
	}
	.shopping-content {
		width: 90%;
		height: auto;
		margin: auto;
	}
	
	.checkbox-content .radio {
		position: absolute;
		top: 10upx;
	}
	
	.checkbox-content text {
		float: right;
		padding-top: 8upx;
		color: #FFFFFF;
		padding-right: 20upx;
		font-size: 30upx;
	}
	
	.checkbox-content {
		position: relative;
		width: 100%;
		height: 55upx;
		border-radius: 30upx;
		margin: 20upx 0px;
		background-color: #C0C4CC;
	}
	
	.checkbox {
		width: 22%;
		line-height: 100%;
		display: flex;
		border-radius: 30upx;
	}
	
	.checkbox uni-image {
		position: absolute;
		top: 22upx;
		left: 68upx;
		z-index: 9999;
	}
	
	.action-contont {
		width: 90%;
		margin: auto;
		display: flex;
		justify-content: space-around;
		background: rgba(255, 255, 255, 0.9);
		box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.5);
		border-radius: 8px;
	}
	
	.action-section {
		width: 100%;
		height: 100upx;
		position: fixed;
		bottom: 130upx;
	}
	
	.item-rightName {
		overflow: hidden;
		/*超出部分隐藏*/
		white-space: nowrap;
		/*让文本强制在一行不换行*/
		text-overflow: ellipsis;
	}
	
	
	.cart-list {
		width: 100%;
		margin: 80upx 0upx;
		display: flex;
		justify-content: space-between;
	}
	
	.item-right {
		width: 50%;
		line-height: 50upx;
		font-size: 30upx;
		margin-left: 20upx;
	}
	
	.image-wrapper {
		width: 30%;
		position: relative;
	}
	
	.image-wrapper .radios {
		position: absolute;
		top: -14upx;
		left: -24upx;
		width: 50upx;
		height: 50upx;
	}
	
	.image-wrapper image {
		width: 230upx;
		height: 230upx;
	}
	
	.del-bt image {
		width: 30upx;
		height: 30upx;
	}
</style>
